<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="d" uri="/WEB-INF/resource.tld" %>

<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/menu.jsp"%>
  
  <div class="container main-content">
  
    <div class="panel panel-default x-panel x-panel-layout">
    
      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host }/user">用户管理</a></li>
          <li class="active">电话资源</li>
          <li class="no-before pull-right" style="min-width: 65px;">
            <a onclick="window.history.back();"><i class="glyphicon glyphicon-arrow-left"></i>&nbsp;&nbsp;返回</a>
          </li>
        </ol>
      </div>
      
      <div class="panel-body">
      
        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>
        
        <div class="col-xs-10 x-panel-layout-right">
        
          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>电话资源&nbsp;-&nbsp;详情</span></h2>
            </div>
          </div>
          
          <div class="x-breadcrumb-wrapper" style="margin-top:20px;">
            <div class="x-breadcrumb yellow clearfix">
              <h2>
                <span>学员基本信息</span>
              </h2>
            </div>
          </div>
          
          <div class="form-horizontal" style="margin-bottom:20px;">
            <div class="form-group">
              <label class="col-xs-2 control-label">手机号码：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${telephoneResource.user.mobile}</p></div>
              
              <label class="col-xs-2 control-label">姓名：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${telephoneResource.user.name}</div>
            </div>
            
            <div class="form-group">
              <label class="col-xs-2 control-label">性别：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${telephoneResource.user.userFit.gender.description}</div>
            </div>
            
            <div class="form-group">
              <label class="col-xs-2 control-label">渠道：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${telephoneResource.channel}</div>
            </div>
            
            <div class="form-group">
              <label class="col-xs-2 control-label">名单收集月份：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static"><fmt:formatDate value="${telephoneResource.collectDate}" pattern="M"/></p></div>
              
              <label class="col-xs-2 control-label">名单收集日期：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static"><fmt:formatDate value="${telephoneResource.collectDate}" pattern="yyyy-MM-dd"/></div>
            </div>
          </div>
          
          <div class="x-breadcrumb-wrapper" style="margin-top:20px;">
            <div class="x-breadcrumb yellow clearfix">
              <h2>
                <span>电话拨打预约备注</span>
              </h2>
            </div>

            <a href="${ctx.host}/telephone-resources/${telephoneResource.id}/telephone-records/add" data-toggle="modal" data-target="#add" style="position: absolute; right: 0px; top: 0px; margin-top: 10px; margin-right: 10px;">添加</a>
          </div>
          
          <table class="table table-striped table-hover x-table" style="margin-bottom:20px;">
            <thead>
              <tr>
                <th width="20%">前台电话接待人</th>
                <th width="20%">接待日期</th>
                <th width="40%">未约成功原因</th>
                <th width="20%">操作</th>
              </tr>
            </thead>
            <tbody>
              <c:forEach var="telephoneRecord" items="${telephoneResource.telephoneRecords}">
                <tr>
                  <td>${telephoneRecord.receptionist.name}</td>
                  <td>${telephoneRecord.receptionTime}</td>
                  <td>${telephoneRecord.failResaon}</td>
                  <td><a href="${ctx.host}/telephone-resources/${telephoneResource.id}/telephone-records/${telephoneRecord.id}/edit" data-toggle="modal" data-target="#edit">修改</a></td>
                </tr>
              </c:forEach>
            </tbody>
          </table>
          
          <div class="x-breadcrumb-wrapper" style="margin-top:20px;">
            <div class="x-breadcrumb yellow clearfix">
              <h2>
                <span>学员到店、买课情况</span>
              </h2>
            </div>
          </div>
          
          <div class="form-horizontal" style="margin-bottom:20px;">
            <c:set var="courseSchedule" value="${persist.telephoneResource(telephoneResource.user.id)}"></c:set>
            
            <div class="form-group">
              <label class="col-xs-2 control-label">预约日期：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${courseSchedule.occurDate}</p></div>
              
              <label class="col-xs-2 control-label">时间：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${courseSchedule.occurHour}</p></div>
            </div>
            
            <div class="form-group">
              <label class="col-xs-2 control-label">是否到店：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${courseSchedule.scheduleStatus.finish ? '是' : (courseSchedule.scheduleStatus.expiry ? '否' : '')}</p></div>
            </div>
            
            <c:if test="${courseSchedule.scheduleStatus.expiry}">
              <div class="form-group">
                <label class="col-xs-2 control-label">未到店原因：</label>
                <div class="col-xs-4 pull-left"><p class="form-control-static">${telephoneResource.breakReason}</p></div>
              </div>
            </c:if>
            
            <div class="form-group">
              <label class="col-xs-2 control-label">是否买课：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static">${telephoneResource.user.ordered ? '是' : '否'}</p></div>
            </div>
            
            <div class="form-group">
              <label class="col-xs-2 control-label">课程数量：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static"></p></div>
              
              <label class="col-xs-2 control-label">课程金额：</label>
              <div class="col-xs-4 pull-left"><p class="form-control-static"></p></div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

 <%@ include file="/WEB-INF/include/script.jsp"%>
 <d:resource root="${ctx.resource}/build" type="script" src="js/page/user/telephone-resource-view.js">
    <script type="text/javascript">
      require(['page/user/telephone-resource-view'], function(page) {
        page.init()
      })
    </script>
  </d:resource>
  
</body>
</html>